# Contributor: Kevin Daudt <kdaudt@alpinelinux.org>
# Maintainer: Kevin Daudt <kdaudt@alpinelinux.org>
pkgname=py3-maxminddb
pkgver=2.0.3
pkgrel=3
pkgdesc="Python MaxMind DB reader extension"
url="https://maxminddb.readthedocs.io/en/latest/"
arch="all"
license="Apache-2.0"
depends="python3"
makedepends="libmaxminddb-dev python3-dev py3-setuptools"
checkdepends="py3-nose py3-mock"
_test_data_commit=dfce8394656a873510d11d0570588da2294e0cf3
source="$pkgname-$pkgver.tar.gz::https://github.com/maxmind/MaxMind-DB-Reader-python/archive/v$pkgver.tar.gz
	MaxMind-DB-test-data-$_test_data_commit.tar.gz::https://github.com/maxmind/MaxMind-DB/archive/$_test_data_commit.tar.gz"

builddir="$srcdir/MaxMind-DB-Reader-python-$pkgver"

prepare() {
	cd "$srcdir"

	# Submodule required for tests
	cp -r "MaxMind-DB-$_test_data_commit/"* "$builddir/tests/data"

	default_prepare
}

build() {
	python3	setup.py build
}

check() {
	python3	setup.py test
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="f853eb0cd3ce756e60ca99bc44f26a593940fd63a6d2b525880e66b7d71d2327d208147eb132c792ebac462ab210ef502f340ef8ab7a09374389f9b90f8a8ded  py3-maxminddb-2.0.3.tar.gz
983b9bb63cc51852d0eb2a29044497bf9800842f485c659a9500a56be564690238a8e1ccfb84beefd99095a18029922128cf8feb538b5896125f30f9fe5143a3  MaxMind-DB-test-data-dfce8394656a873510d11d0570588da2294e0cf3.tar.gz"
